# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=leptonica
pkgver=1.84.1
pkgrel=0
pkgdesc="Software that is broadly useful for image processing and image analysis applications"
url="http://www.leptonica.com/"
arch="all"
license="custom"
makedepends="automake autoconf libtool libjpeg-turbo-dev tiff-dev libpng-dev zlib-dev giflib-dev libwebp-dev"
subpackages="$pkgname-dev $pkgname-doc"
source="https://github.com/DanBloomberg/leptonica/releases/download/$pkgver/leptonica-$pkgver.tar.gz
	disable-one-failing-test.patch
	"

prepare() {
	default_prepare
	autoreconf -fi
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	rm -f "$pkgdir"/usr/lib/*.a "$pkgdir"/usr/lib/*.la
	install -Dm644 leptonica-license.txt "$pkgdir/usr/share/licenses/$pkgname/leptonica-license.txt"
}

sha512sums="
949be33a09e1dfc04527f5401d3d682999bd6904dca0b4950b457d12564e3290ec5b62ab4b14ef14d6f499a0fbfa0ebc37c2e8ab2966913883127b9489f47e97  leptonica-1.84.1.tar.gz
37afa0a0b7e0b5ef3ed0bd5106ae221bfb48d966ba02f308076eca4a469d79e69b42d86bdd95563bdc6fe976ed218848160670fa7a261ad6a393e3755962952a  disable-one-failing-test.patch
"
